<template>
	<view class="food" @click="select()">
		<view class="food-in">
			<image class="food-image" :src="item.image" mode="aspectFill"></image>
			<text class="food-name">{{item.storeName}}</text>
			<text class="food-price">¥ {{item.price}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		name: "food",
		props: {
			item: {
				type: Object,
				default() {
					return {}
				}
			},
			popup: {}
		},
		data() {
			return {
			}
		},
		methods: {
			select() {
				this.popup.getFoodDetail(this.item.id, null)
			}
		}
	}
</script>

<style scoped>
	.food {
		background: #fff;
		border-radius: 16px;
		width: calc((100% - 22px) / 2);
		margin-top: 14px;
	}

	.food-in {
		padding: 12px 7px;
		display: flex;
		flex-direction: column;
	}

	.food-image {
		width: 100%;
		height: calc(var(--base) * 124);
		border-radius: 18px;
	}

	.food-name {
		font-size: calc(var(--base) * 14);
		color: #333;
		padding: calc(var(--base) * 10) 0;
	}

	.food-price {
		font-size: calc(var(--base) * 12);
		font-weight: bold;
		color: #f00;
	}

	.food:hover {
		background: #4eaaff;
	}

	.food:hover .food-name {
		color: #fff;
		font-weight: bold;
	}

	.food:hover .food-price {
		color: #fff;
	}
</style>